package com.itheima.controller;

import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RequestMapping("/report")
@RestController
public class ReportController {

    @Autowired
    private ReportService reportService;

    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        log.info("统计各个职位的员工人数");
        Map map = reportService.getEmpJobData();
        return Result.success(map);
    }

    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        log.info("统计员工性别分布数据");
        List<Map> list = reportService.getEmpGenderData();
        return Result.success(list);

    }

    @GetMapping("/studentDegreeData")
    public Result getStuDegreeData(){
        log.info("统计学生学历分布数据");
        List<Map> list = reportService.getStuDegreeData();
        return Result.success(list);
    }

    @GetMapping("/studentCountData")
    public Result getStuCountData(){
        log.info("统计各个班级的学生人数");
        Map map = reportService.getStuCountData();
        return Result.success(map);
    }

}
